/*
 * This is written by Lulu Han.
 * E-mail: locomotive_crypto@163.com
 */
 
#include <iostream>
#include "net_server.h"

int main(){
	
	NetServer server(11333); // define the  Server object
	
	server.accept(); // accept the Client's connection
	
	// Testing for sending or receiving data
	long n = 123456;
	server.send(n); 
	
	NTL::ZZ zz;
	server.receive(zz);
	std::cout << "zz = " << zz << std::endl << std::endl;
	
	std::string str("This message is from Server");
	server.send(str);
	
	std::vector<NTL::ZZ> vzz;
	vzz.push_back(NTL::ZZ(1345)); vzz.push_back(NTL::ZZ(2666)); vzz.push_back(NTL::ZZ(3156)); 
	vzz.push_back(NTL::ZZ(4222)); vzz.push_back(NTL::ZZ(5229)); vzz.push_back(NTL::ZZ(7555));
	server.send(vzz);
	
	std::vector<std::vector<NTL::ZZ>> vvzz;
	server.receive(vvzz);
	std::cout << "vvzz = " << std::endl;
	for(auto vele : vvzz){
		for(auto ele: vele){
			std::cout << ele << " ";
		}
		std::cout << std::endl;
	}
	std::cout << std::endl;
	
	
	NTL::RR r;
	r = 1234.5678;
	server.send(r);
	
	server.close();
	server.run();
	return 0;
}
